package me.zhengjie.modules.system.utils.common;

import cn.hutool.core.codec.Base64;
import cn.hutool.http.HttpUtil;

public class PhotoUtil {

    public static String transFerLinkToBase64(String path) {
        // 获取图片的字节数组
        byte[] imageBytes = HttpUtil.downloadBytes(path);
        // 将字节数组转为Base64字符串
        return Base64.encode(imageBytes);
    }


    public static void main(String[] args) {
        String s = transFerLinkToBase64("https://tudincf.oss-cn-hangzhou.aliyuncs.com/system2.0/photo/user-id-83/20250214/bf328380-092f-4873-b607-bd82faeee164.jpg");
        System.out.println(s);
    }
}
